﻿Imports System
Imports System.Collections.Generic
Imports System.Workflow.ComponentModel
Imports System.Workflow.Runtime

Namespace System.Workflow.Runtime.Tracking
    <Serializable> _
    Public Class WorkflowDataTrackingExtract
        Inherits TrackingExtract
        ' Methods
        Public Sub New()
            Me._annotations = New TrackingAnnotationCollection
        End Sub

        Public Sub New(ByVal member As String)
            Me._annotations = New TrackingAnnotationCollection
            Me._name = member
        End Sub

        Friend Overrides Sub GetData(ByVal activity As Activity, ByVal provider As IServiceProvider, ByVal items As IList([Of] TrackingDataItem))
            Dim activity2 As Activity = ContextActivityUtils.RootContextActivity(activity)
            If ((Me._name Is Nothing) OrElse (Me._name.Trim.Length = 0)) Then
                PropertyHelper.GetAllMembers(activity2, items, Me._annotations)
            Else
                Dim item As TrackingDataItem = Nothing
                PropertyHelper.GetProperty(Me._name, activity2, Me._annotations, item)
                If (Not item Is Nothing) Then
                    items.Add(item)
                End If
            End If
        End Sub


        ' Properties
        Public Overrides ReadOnly Property Annotations As TrackingAnnotationCollection
            Get
                Return Me._annotations
            End Get
        End Property

        Public Overrides Property Member As String
            Get
                Return Me._name
            End Get
            Set(ByVal value As String)
                Me._name = value
            End Set
        End Property


        ' Fields
        Private _annotations As TrackingAnnotationCollection
        Private _name As String
    End Class
End Namespace

